package C031;

/**
 * ClassName: Code04_LeftToRightAnd
 * Package: C031
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/12/27 16:59
 * @Version 1.0
 * @Since 1.0
 */
public class Code04_LeftToRightAnd {
    public static void main(String[] args) {
        System.out.println(leftToRight(1, 3));
    }

    public static int leftToRight(int l, int r) {
        while(l < r) {
            r -= (r & (~r + 1));
        }
        return r;
    }
}
